package com.yanqu.road.server.cmd.activity.suoyao;

import com.yanqu.road.pb.activity.SuoYaoActivityProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = GameProtocol.S_SUOYAO_ACTIVITY_SYNC_NOTICE, desc = "跨服锁妖塔同步公告")
public class SyncSuoYaoNoticeFromCorssCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        SuoYaoActivityProto.SyncSuoYaoNoticeRespMsg reqMsg = SuoYaoActivityProto.SyncSuoYaoNoticeRespMsg.parseFrom(packet.getBytes());
        for (GamePlayer gamePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
            gamePlayer.sendPacket(ClientProtocol.U_SUOYAO_ACTIVITY_SYNC_NOTICE, reqMsg.toBuilder());
        }
    }
}
